<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			//方法1
			var obj = {
				name: 'keke',
				type: 'alasiga',
				age: 5,
				color: 'red',
				bark: function() {
					console.log('汪汪汪')
				},
				showfilm: function() {
					console.log('演电影')
				}
			}
			console.log(obj.color);
			obj.showfilm();

			//方法2
			var obj1 = new Object();
			obj1.name = '鸣人';
			obj1.sex = '男';
			obj1.age = 19;
			obj1.skill = function() {
				console.log('影分身');
			}
			console.log(obj1.sex);
			obj1.skill();

			//构造函数
			function Hero(name, type, blood, attack) {
				this.name = name;
				this.type = type;
				this.blood = blood;
				this.attack = attack;
			}
			var hy = new Hero('后裔', '射手', 100, '远程');
			var lp = new Hero('廉颇', '坦克', 500, '近战');
			console.log(hy.type);
			console.log(lp['attack']);
		</script>
	</head>
	<body>
	</body>
</html>
